Objectif
- Héberger un site web avec Nginx
- Modifier les fichiers depuis Windows
- Setup stable (sans bug SMB / invité)
1. Installer les paquets
sudo apt update sudo apt install nginx samba
2. Dossier web
sudo mkdir -p /srv/webshare sudo chown -R www-data:www-data /srv/webshare sudo chmod -R 775 /srv/webshare
3. Config Samba (PROPRE)
sudo adduser webuser sudo smbpasswd -a webuser
[global] workgroup = WORKGROUP security = user [WebShare] path = /srv/webshare browseable = yes read only = no valid users = webuser force user = www-data
sudo systemctl restart smbd
4. Accès depuis Windows
\\192.168.1.__\WebShare
Identifiants :
user : webuser
mdp : ton mot de passe
ou solution alt :
net use Z: \\192.168.1.__\WebShare /user:webuser tonmotdepasse
5. Config Nginx
sudo nano /etc/nginx/sites-available/default
server {
listen 80 default_server;
root /srv/webshare;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
sudo nginx -t sudo systemctl reload nginx
Résultat
Site dispo : http://192.168.1._
Drag & drop depuis Windows
Pas de bug SMB
Setup stable
Bonus : HTTPS + Accès Internet (Certbot)
Pour rendre ton site accessible depuis Internet avec HTTPS :
1. Nom de domaine
Prends un domaine (ex : OVH, Cloudflare, etc.)
2. DNS
Crée un enregistrement A → vers ton IP publique
3. Ouvrir les ports sur ta box
Port 80 → 192.168.1.__ Port 443 → 192.168.1.__
obligatoire pour que Certbot fonctionne
4. Installer Certbot
sudo apt update sudo apt install certbot python3-certbot-nginx
5. Générer le certificat
sudo certbot --nginx
Réponds aux questions :
- mets ton domaine
- accepte les conditions
- redirection HTTPS → OUI
6. Résultat
Ton site devient accessible en https://tondomaine.com
Certificat auto-renouvelé
Sécurisé
7. Test renouvellement (optionnel)
sudo certbot renew --dry-run